home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
001
/
prcm_cmd.arc
/
CMDFILES.DOC
Wrap
Text File
|
1987-01-18
|
22KB
|
583 lines
7. C O M M A N D F I L E S
Command files are text files you create that contain ProComm commands.
You can use command files to perform automatic logons, perform unattended
file transfers and many other tasks. You can even link command files to
the entries in your dialing directory so that the entire dialing and
logon procedure is automated.
You can create a command file using virtually any word processor which
saves in straight ASCII format; if your word processor normally makes use
of special or extended ASCII characters, then you should use its
"non-document" mode. A command file may have any valid filename;
however, ProComm looks for files with an extension of .CMD when it lists
available command files.
Command files can be executed from within ProComm or as a command line
option when you first invoke the program. If you specify them on the
command line, using the "/F" option, they will be executed immediately
upon program startup. Execute them from inside the program by pressing
Alt-F5. ProComm first searches the current directory for files with the
.CMD extension. If any are found, their names are displayed in the
window. If none are found, ProComm will look in the directory pointed to
by the ProComm environment variable. Again, the names of any files found
are displayed in the window. If no files are found in either directory,
the message "NO FILES" will be displayed.
To execute a command file you may either type the filename or choose from
the scrolling window display of available .CMD files. If you type the
filename, you may omit the .CMD extension. To choose from the scrolling
window, position the highlight on the name of the file you wish to
execute and press <CR>. PgUp and PgDn will scroll the window one page in
either direction. The arrow keys will scroll the window one entry in
either direction. Pressing the Home key will position the list at the
first page of available command files; pressing End will position it at
the last. If you don't see the highlighted entry, use the Alt-Z command
to change the color being used for highlighting so that it is different
than that being used for regular foreground display. The command file
window uses the colors displayed in Alt-Z for the file transfer window.
Once you begin to enter a command file name at the prompt you may still
scroll the window, but you may not select a file for execution from the
scrolling display.
Abort a command file by pressing <ESC> during its execution. The command
file will abort when the current command has completed (which might take
a few seconds). In some cases, such as while dialing or performing a
file transfer, two <ESC>'s are needed: one to abort the task in progress
and a second to abort the command file.
There is a special command file named PROFILE.CMD which ProComm looks for
in the default directory first, then in the directory pointed to by the
Copyright (C) 1986 Datastorm Technologies, Inc. 701
ProComm 2.4 Command Files
ProComm environment variable (see Section 1). If PROFILE.CMD is found,
it will be executed immediately upon program startup, before any other
command file specified as a "/F" command line option. You can use the
profile to do such custom setup work as changing to a special directory,
turning off the sound, changing line settings, or overriding the default
modem initialization string.
Command File Syntax
Command file commands begin with special command words, listed below.
Commands may be entered in either upper- or lower-case. When processing
commands ProComm looks only at the first 4 characters. Thus all the
following commands are treated the same:
TRANSMIT = trans = Tran = TRANSM
Each command must appear on a separate line.
IF NOT CONNECTED ; this is correct
MESSAGE "sorry!" ;
ENDIF ;
IF NOT CONNECTED MESSAGE "sorry!" ; this is incorrect
ENDIF ;
Many commands have one or more additional arguments; if the argument is
listed in brackets ([]) it is optional, otherwise it is required.
Arguments listed within quotation marks (" ") should include the
quotation marks; thus the command RUN, if you wish to use it to run
WordStar, would be typed
RUN "WORDSTAR"
Arguments may be separated by blanks or commas. Thus both
GETFILE XMODEM "FILE.EXT"
and
GETFILE,XMODEM,"FILE.EXT"
are valid.
To use the quotation character in a quoted string, precede it with the
special escape character ` (the reverse tick mark, or accent grave, ASCII
`
96). Thus to print the message
She said "Goodbye" and then went home.
use the command
MESSAGE "She said `"Goodbye`" and then went home."
Labels are used as targets of GOTOs and GOSUBs. Labels must end with a
colon. Below are some valid labels:
LABEL1:
Copyright (C) 1986 Datastorm Technologies, Inc. 702
ProComm 2.4 Command Files
This_is_a_long_label:
JUMP1:
split:
GO_HERE:
Labels must appear on a line by themselves. (Comments are allowed on
label lines; executable statements are not). Labels may be of any
length; however, only the first 8 characters are used by the interpreter.
Thus LABEL_TAG1: and LABEL_TAG2 are the same as far as ProComm is
concerned.
Comments begin with a semi-colon (;). Any text following a semi-colon is
treated as comment text. Below are valid comments:
; This is a comment.
LABEL7: ;This is a comment on a label line
TRANSMIT "Welcome back" ;And this is a comment as well
There are 10 string variables, named S0-S9, which may be set and used in
place of quoted strings. They have a maximum length of 80 characters
each. They may be set by the ASSIGN, GET and RGET commands. String
variables may be used in place of a quoted string in any of the commands
marked below with the @ character. For example, the commands
ASSIGN S5 "Hello, Mike Todd here"
TRANSMIT S5
and
TRANSMIT "Hello, Mike Todd here"
are functionally the same. One of the most useful applications of string
variables is in obtaining and using user responses. Consider the
commands below:
MESSAGE "Enter the name of the file to upload:"
GET S4
SENDFILE XMODEM S4
String variables are also a very handy method for passing values between
command files. When you chain from command file to command file, using
the EXECUTE command, string variable contents are not reset. Thus you
may set a variable in one command file, and act on the variable in
another.
ProComm allows the nesting of commands such as IF, SWITCH and GOSUB.
Nesting, however, is limited to 10 levels.
Characters that are received from a remote system are stored in the
receive buffer. During command file execution, the receive buffer is
emptied before each command is executed, with the exceptions noted below.
What this means is that before each command is performed, all the
characters that have come in are displayed on the screen and are
therefore not available to be processed by later commands. The
exceptions are the GET, RGET and WAITFOR commands, as well as labels and
comments. In these cases the buffer is not emptied, allowing the command
to process the accumulated characters. The point here is that if you
have a command sequence that looks like
Copyright (C) 1986 Datastorm Technologies, Inc. 703
ProComm 2.4 Command Files
TRANSMIT "password!"
PAUSE 5
SET DUPLEX HALF
WAITFOR "target"
the text you are looking for may come in and be processed before the
WAITFOR command has a chance to see it. A better solution would be to
change duplex at some other point, and let the WAITFOR command do the
extra pausing:
SET DUPLEX HALF
TRANSMIT "password!"
WAITFOR "target" 35 ; 30 seconds is the default pause
Use the commands described below to perform your specific task. Be sure
to test your command files thoroughly before using them for unattended
communications.
The following notations apply to the commands listed below: Commands
marked with an asterisk (*) may be tested with the IF command. Commands
marked with an at-sign (@) indicate where string variables may be used in
place of quoted strings. Sx indicates that you should use one of the
string variables. Ellipses (...) mean that you may place a number of
command lines in that spot.
Top Level Commands
ALARM [seconds]
The ALARM command will sound an alarm to alert you to some event. Use
the [seconds] option to determine the amount of time the alarm will
sound. If the [seconds] option is not specified ProComm will use the
Alarm Time specified in the General SetUp screen. This command is also
under control of the Alarm Sound setting. Both Alarm Sound and Alarm
Time may be regulated using the SET command described below.
Example: ALARM 5 ; sounds the alarm for 5 seconds
ASSIGN Sx "string" @
This command assigns the contents of "string" to a user variable. Use
ASSIGN to set a user variable from within your command file.
Examples: ASSIGN S5 "12345" ; set S5 to contain the string '12345'
ASSIGN S6 S5 ; sets S6 to be the same as S5
BREAK [time]
The BREAK command is used to send a break to the remote system. The
optional [time] argument determines the length of the break in
milliseconds. If [time] is not specified, ProComm will use the default
as indicated by the Break Length option in the Terminal SetUp screen.
Copyright (C) 1986 Datastorm Technologies, Inc. 704
ProComm 2.4 Command Files
Examples: BREAK ; send a break using the default timing
BREAK 500 ; send a 500 millisecond break
CHDIR "drive and/or directory" @
The CHDIR command will change the logged directory and/or drive.
Examples: CHDIR "A:" ; change the logged drive to A:
CHDIR "C:\COMM" ; change to \COMM dir on drive C:
CHDIR "\COMM" ; change logged dir to \COMM
CLEAR [bg fg]
The CLEAR command is used to clear the top 24 lines of your screen. The
optional parameter [bg fg] (you must use both codes) allows you to change
your background (bg) and foreground (fg) colors. If the [bg fg] option
is not used, the screen will be cleared to the current colors. If the
[bg fg] option is used, ProComm will clear the screen to the new colors
as well as reset the current colors to those specified. The codes to use
for colors are as follows:
0 Black 8 Dk Grey (8-15 are the bright
1 Blue 9 Lt Blue colors)
2 Green 10 Lt Green
3 Cyan 11 Lt Cyan
4 Red 12 Lt Red
5 Magenta 13 Lt Magenta
6 Brown 14 Yellow
7 Lt Grey 15 White
Only the codes 0-7 are valid for background colors; any of the sixteen
colors may be used for the foreground.
Examples: CLEAR 0 10 ; clear screen to lt green on black
CLEAR ; clear screen to current colors
DIAL "entry" @
The DIAL command is used to call an entry in your dialing directory.
Specify the number of the entry, optionally preceded and/or followed by a
long distance code identifier as the argument.
Examples: DIAL "5" ; call entry number 5
DIAL "#5" ; call entry 5 using ld code '#'
If a second command file is linked via the dialing directory to the entry
being dialed, the linked command file will not be executed. Place all
statements to be executed in the command file which initiates the call.
Copyright (C) 1986 Datastorm Technologies, Inc. 705
ProComm 2.4 Command Files
Use the IF LINKED command to avoid secondary dialing in command files
linked to dialing directory entries. For example, including the commands
IF NOT LINKED ; do not execute the dial command if
DIAL "5" ; this file is executing via linkage
ENDIF ; to a dialing directory entry
in a command file linked to entry number 5 allows you to use that command
file both as a stand alone file and linked to the dialing directory
entry.
This command uses the auto redial facility to place its calls; it will
keep re-dialing until a connection is made. To make a call without using
auto redial, use the TRANSMIT command.
Examples: TRANSMIT "ATDT1 314 449-9401!" ; place the call
PAUSE 10 ; wait 10 seconds
IF CONNECTED
... ; do these commands if
ENDIF ; connected
Remember, if you sort your dialing directory you will need to change your
command files so the entry numbers match.
DOS "command" [WAIT] @ *
The DOS command allows you to execute DOS commands or other programs from
within a ProComm .CMD file. Enter the "command" as it would appear on
the DOS command line. For example, to go out to DOS and type a file
named FILE.EXT to your printer use the command:
DOS "type FILE.EXT > prn"
If the optional argument WAIT is included, ProComm will wait for a
keystroke after executing the command, before returning to ProComm.
To execute this command properly you must make sure of two things.
First, you must have enough memory to run the "command". Secondly,
COMMAND.COM must be where ProComm can find it. (Either in the boot
location or wherever COMSPEC is pointing). While this command returns an
error status checkable with the IF command, the error check is very
limited. The DOS command will indicate FAILURE only if COMMAND.COM was
not found. IF COMMAND.COM was found, even if the command to be executed
was invalid, SUCCESS will be returned.
Examples: DOS "del FILE.EXT" ; delete a file
DOS "sortdisk" ; run a program called sortdisk
IF FAILURE
MESSAGE "COMMAND.COM not found"
ENDIF
CAUTION: If you execute a program or command requiring user input be sure
you are around to provide it, since the program will wait until you do.
EMULATE terminal -or- EMULATE "terminal"
Copyright (C) 1986 Datastorm Technologies, Inc. 706
ProComm 2.4 Command Files
The EMULATE command changes the active emulation to that specified.
Valid terminal types are: VT100, VT52, IBM3101, TV920, TV950, ADM5,
HEATH19, ANSI, ADDSVP and WYSE100.
Examples: EMULATE VT100 ; change emulation to VT100
EMULATE "IBM3101" ; emulate the 3101
EXECUTE "cmd file" @
The EXECUTE command allows you to begin execution of a different command
file. The currently executing command file will be ended and will not be
returned to. The EXECUTE commands allows a one-way chaining of command
file execution. The file extension of .CMD need not be specified.
Remember, string variables are not reset when chaining command files so
you may use them to pass values. String variables are reset to null,
however, when you begin the first command in the chain.
Examples: EXECUTE "CALL_KEN.CMD" ; execute CALL_KEN.CMD
SWITCH S0 ; switch based on option
CASE "A"
ASSIGN S1 "CHOICEA.CMD"
ENDCASE
CASE "B"
ASSIGN S1 "CHOICEB.CMD"
ENDCASE
DEFAULT
ASSIGN S1 "DEFAULT.CMD"
ENDCASE
ENDSWITCH
EXECUTE S1
EXIT
The EXIT command terminates the executing command file and returns you to
Terminal Mode.
Examples: TRANSMIT "Goodbye" ; log off remote
HANGUP ; hangup phone
EXIT ; return to Terminal Mode
FIND Sx "target" @ *
The FIND command looks for an occurrence of the "target" string in the
string variable Sx. Test for an occurrence of "target" within Sx using
the IF FOUND command. The FIND command is not case sensitive.
Examples: MESSAGE "Enter the password:" ; prompt
MGET S0 ; get with mask
FIND S0 "password" ; look for password
IF NOT FOUND ; found ?
Copyright (C) 1986 Datastorm Technologies, Inc. 707
ProComm 2.4 Command Files
MESSAGE "Invalid password" ; not found, do this code
GOTO SECURITY_BREACH
ELSE
GOSUB WELCOME ; found, do this
ENDIF
GET Sx [length]
The GET command is used to obtain and store user input. The Sx argument
determines which string variable is used to hold the data. The optional
[length] variable determines the maximum number of characters that will
be accepted. If the [length] argument is not specified, the maximum size
of 80 characters is used.
When responding to a GET command, the user must enter a <CR> to signal
that his input is complete. The <CR> is not included in the string
variable. If the [length] argument is used, the user will be allowed to
enter up to [length] number of characters, but still must use a <CR> to
complete his entry. ProComm will beep if the user attempts to enter more
than [length] characters.
The MGET command is the same as the GET command except that the text the
user enters is not displayed; rather each character typed will display as
an asterisk (*). This is handy for security-related items such as
passwords.
Examples: MESSAGE "Enter your choice: (A,B or C)"
GET S3 1
SWITCH S3
...
ENDSWITCH
MESSAGE "Enter the password"
MGET S9 8
FIND S9 "secret"
IF NOT FOUND
MESSAGE "You are not an authorized user."
QUIT
ENDIF
GETFILE
KERMIT *
XMODEM "filename" @ *
WXMODEM "filename" @ * (Widowed XMODEM)
RXMODEM "filename" @ (Relaxed XMODEM)
YMODEM "filename" @ *
BYMODEM * (YMODEM Batch)
TELINK *
MODEM7 *
ASCII "filename" @ *
CISB * (CompuServe B)
The GETFILE command performs a file download (receive). A number of
protocols are currently supported; see the section on file transfers for
more information on each protocol.
Copyright (C) 1986 Datastorm Technologies, Inc. 708
ProComm 2.4 Command Files
To perform a download you must first initiate the transfer on the remote.
When that system indicates that it is ready, begin your transfer.
Note that 4 protocols require you to specify the filename to receive; for
the other protocols, the filename is provided by the sending system. All
transfers may be checked for successful completion using the IF
SUCCESS/FAILURE command.
Examples: WAITFOR "Begin your transfer now" ; wait till it's ready
GETFILE XMODEM "FILE.EXT" ; receive FILE.EXT